package com.spa.application.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

/**
 * excel导出转换上下架
 */
public class IsDelConverter implements Converter<Integer> {


    @Override
    public Class<?> supportJavaTypeKey() {
        return Integer.class;
    }

    @Override
    public WriteCellData<String> convertToExcelData(Integer value, ExcelContentProperty contentProperty,
            GlobalConfiguration globalConfiguration) {
        if(value == null){
            return null;
        }
        if(value.equals(0)){
            return new WriteCellData<String>("正常");
        }else if(value.equals(1)){
            return new WriteCellData<String>("已下架");
        }else{
            return null;
        }
    }
}